package com.java.tutorials.spring.springInAction4th.chapter01.sia;

import com.java.tutorials.spring.springInAction4th.chapter01.sia.knights.Knight;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Created by xuzhike on 2016/2/16.
 */
//@RunWith(SpringJUnit4ClassRunner.class)
public class Chapter01Tester {
    public static void main(String[] args) throws Exception {
        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext(
                        "SpringInAction4th/chapter01/knight.xml");
        Knight knight = context.getBean(Knight.class);
        knight.embarkOnQuest();
        context.close();
    }

    @Test
    public void testSlayDragon(){
        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext(
                        "SpringInAction4th/chapter01/knight.xml");
        Knight knight = context.getBean(Knight.class);
        knight.embarkOnQuest();
        context.close();
    }

    @Test
    public void testRescueDamsel(){
        ClassPathXmlApplicationContext context =
                new ClassPathXmlApplicationContext(
                        "SpringInAction4th/chapter01/minstrel.xml");
        Knight knight = context.getBean(Knight.class);
        knight.embarkOnQuest();
        context.close();
    }
}
